<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<jsp:root version="1.2"
      xmlns:jsp="http://java.sun.com/JSP/Page"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:a4j="http://richfaces.org/a4j"
	  xmlns:rich="http://richfaces.org/rich">
  
	<html xmlns="http://www.w3.org/1999/xhtml" >
		<head>
			<meta http-equiv="Content-Type" content="text/html;charset=utf-8" ></meta>
		</head>

		<ui:composition>
			<a4j:form>
				<rich:toolBar id="toolBar">
					<rich:toolBarGroup location="left">
						<rich:dropDownMenu rendered="#{(not empty userBean.autoridade) and (userBean.autoridade.nome == 'ROLE_USER' or userBean.autoridade.nome == 'ROLE_ADMIN')}">
			                <f:facet name="label"> 
			                    <h:panelGroup>
			                        <h:outputText value="#{labels['menu.acompanhar']}"/>
			                    </h:panelGroup>
			                </f:facet>
			                
		                	<rich:menuItem submitMode="server" value="#{labels['menu.minhasAtividades']}" 
		                        action="#{recursoServiceImpl.findAll}" rendered="#{(not empty userBean.autoridade)}"/>
		                	<rich:menuItem submitMode="server" value="#{labels['menu.meusProjetos']}"
		                        action="#{papelServiceImpl.findAll}" rendered="#{(not empty userBean.autoridade) and (userBean.autoridade.nome == 'ROLE_MANAG') or (userBean.autoridade.nome == 'ROLE_ADMIN')}"/>
			           	</rich:dropDownMenu>
			           	
						<rich:dropDownMenu rendered="#{(not empty userBean.autoridade) and userBean.autoridade.nome == 'ROLE_ADMIN'}">
			                <f:facet name="label">
			                    <h:panelGroup>
			                        <h:outputText value="#{labels['menu.manutencao']}"/>
			                    </h:panelGroup>
			                </f:facet>
			                <rich:menuGroup value="Sistema">
			                	<rich:menuItem submitMode="server" value="#{labels['menu.papeis']}"
			                        action="#{papelServiceImpl.findAll}" />
			                	<rich:menuItem submitMode="server" value="#{labels['menu.recursos']}" 
			                        action="#{recursoServiceImpl.findAll}" />
			                    <rich:menuItem submitMode="server" value="#{labels['menu.statusAtividade']}" 
			                        action="#{statusAtividadeServiceImpl.findAll}" />
			                    <rich:menuItem submitMode="server" value="#{labels['menu.tipoApontamento']}" 
			                        action="#{tipoApontamentoServiceImpl.findAll}" />   
		                	</rich:menuGroup>
		                	<rich:menuItem submitMode="server" value="#{labels['menu.projetos']}"
			                        action="#{projetoServiceImpl.findAll}" />
			           	</rich:dropDownMenu>
						
						<h:outputText value="#{labels['menu.login']}" rendered="#{empty userBean.autoridade}"/>			            	
		            </rich:toolBarGroup>
							            
		            <rich:toolBarGroup location="right">
						<a4j:commandLink value="#{userBean.nome} #{userBean.sobrenome}" style="text-decoration: none; color: black;" rendered="#{not empty userBean.autoridade}"/>
						<a4j:commandLink action="logout" value="#{labels['menu.sair']}" style="text-decoration: none" rendered="#{not empty userBean.autoridade}"/>
					</rich:toolBarGroup>
		    	</rich:toolBar>
			</a4j:form>
		</ui:composition>
	</html>
</jsp:root>